package com.itfreer.gather;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.itfreer.ui.base.DomainRadioView;
import com.itfreer.ui.base.TextView;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 查询
 */
public class SearchFragment extends Fragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view =  inflater.inflate(R.layout.fragment_search, container, false);

        // 返回
        TextView back =(TextView)view.findViewById(R.id.searchBack);
        back.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
                Fragment fragment = fragmentManager.findFragmentByTag("searchFragment");
                fragmentManager.beginTransaction()
                .hide(fragment)
                .commit();
            }
        });

        Map data = new LinkedHashMap<String, String>();
        data.put("1", "市");
        data.put("2", "县");
        data.put("3", "林班");
        data.put("4", "小班");
        data.put("5", "地类");

        DomainRadioView dcFile = (DomainRadioView)view.findViewById(R.id.dcFile);
        dcFile.setBindData(data);
        dcFile.setDialogTitle("字段");
        DomainRadioView dcFile2 = (DomainRadioView)view.findViewById(R.id.dcFile2);
        dcFile2.setBindData(data);
        dcFile2.setDialogTitle("字段");

        data = new LinkedHashMap<String, String>();
        data.put("1", "like");
        data.put("2", "=");
        data.put("3", ">");
        data.put("4", "<");

        DomainRadioView dcOption = (DomainRadioView)view.findViewById(R.id.dcOption);
        dcOption.setBindData(data);
        dcOption.setDialogTitle("操作符");
        DomainRadioView dcOption2 = (DomainRadioView)view.findViewById(R.id.dcOption2);
        dcOption2.setBindData(data);
        dcOption2.setDialogTitle("操作符");

        return view;
    }

}
